package cn.as142.config;

import cn.as142.pojo.Teacher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration//配置类
public class JavaConfig {
    @Bean(initMethod = "init")//向sping的ioc容器注入一个Teacher对象 initMethod实例化对象后执行的方法
    public Teacher teacher(){
        Teacher teacher=new Teacher();
        return teacher;
    }
}
